//
//  ME_moreVCShareView.m
//  NBProduct
//
//  Created by hl on 16/3/1.
//  Copyright (c) 2016年 ping. All rights reserved.
//

#import "ME_moreVCShareView.h"

@implementation ME_moreVCShareView
-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self createdSubView];
    }
    return self;
}
-(void)createdSubView{

    NSArray *shareArr = @[@"分享微信好友",@"分享朋友圈",@"分享QQ好友"];
    NSArray *imageArr = @[@"fx_weixin",@"fx_pengyouquan",@"fx_QQ"];
    float X = 40 * _kscW;
    float Y = 10*_kscH;
    float W = 30*_kscW;
    float H = 30*_kscH;
    float JianGe = (KScreenWidth - X*2 - W*shareArr.count)/(shareArr.count-1);
    
    for (int i = 0; i<shareArr.count; i++) {
        
        UIImageView *tipImageView = [[UIImageView alloc] initWithFrame:CGRectMake(X + i*(JianGe + W), Y, W, H)];
        tipImageView.image = [UIImage imageNamed:[imageArr objectAtIndex:i]];
        [self addSubview:tipImageView];
        
        UILabel *tipLab = [[UILabel alloc] initWithFrame:CGRectMake(tipImageView.left - 15 *_kscW, tipImageView.bottom+5*_kscH, tipImageView.width + 30*_kscW, 10 * _kscH)];
        tipLab.font = [UIFont systemFontOfSize:10.0*_kscH];
        tipLab.textColor = [UIColor grayColor];
        tipLab.textAlignment = NSTextAlignmentCenter;
        tipLab.text = [shareArr objectAtIndex:i];
        [self addSubview:tipLab];
        
        UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(tipLab.left, tipImageView.top, tipLab.width, tipLab.bottom - tipImageView.top)];
        
        btn.tag = i;
        [btn addTarget:self.delegate action:@selector(shareButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
       // [btn setImage:[UIImage imageNamed:[imageArr objectAtIndex:i]] forState:UIControlStateNormal];
        [self addSubview:btn];

    }
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
